Vue.component("olist",{
	data(){
		return {
			items:[],
			goods:[]
		};
	},
	template:
		`	
		<table>
		<tbody v-for = "i in items">
			
				<tr>
					<th colspan="5">
					订单号:{{i.oid}}  
					金额:<font color="red">{{i.total}}</font>
					状态 :
						<a href="pay.html"><font color="red">{{i.state}}</font></a>
			
					</th>
				</tr>
				
			<tr>
				<th>图片</th>
				<th>商品</th>
				<th>价格</th>
				<th>数量</th>
				<th>小计</th>
			</tr>
				
				<tr v-for="g in goods" v-if="i.oid==g.oid">
					<td width="60">
						<img :src="g.image"/>
					</td>
					<td>
						<a target="_blank">{{g.pname}}</a>
					</td>
					<td>
						{{g.shop_price}}
					</td>
					<td class="quantity" width="60">
							{{g.count}}							
					</td>
					<td width="140">
						<span class="subtotal">￥{{g.shop_price*g.count}}</span>
					</td>
				</tr>
				
				</tbody>
				</table>
		`,
	created(){
		axios.get("olist1.s").then(res=>{
			if(res.data!=null){
				this.items = res.data;
			}
		})
		axios.get("olist2.s").then(res=>{
			if(res.data!=null){
				this.goods = res.data;
			}
		});
	}
});